package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.data.BaseData;
import com.cskaoyan.bean.issue.IssueCreateBO;
import com.cskaoyan.bean.issue.IssueCreateVO;
import com.cskaoyan.bean.issue.IssueListUnitVO;
import com.cskaoyan.bean.issue.IssueReq;
import com.cskaoyan.service.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: whyccz-mall-project
 * @description:
 * @create: 2021-06-06 19:52
 **/
@RestController
@RequestMapping("admin/issue")
public class AdminIssueController {
	@Autowired
	IssueService issueService;

	@RequestMapping("list")
	public BaseRespVo issueList(IssueReq issueReq){
		BaseData<IssueListUnitVO> issueList= issueService.selectIssueList(issueReq);
		return BaseRespVo.ok(issueList);
	}

	@RequestMapping("create")
	public BaseRespVo issueCreate(@RequestBody IssueCreateBO issueCreateBO){
		IssueCreateVO issueCreateVO=issueService.createIssue(issueCreateBO);
		return BaseRespVo.ok(issueCreateVO);
	}

	@RequestMapping("update")
	public BaseRespVo issueUpdate(@RequestBody IssueCreateVO issueCreateVO){
		IssueCreateVO issueUpdate= issueService.updateIssue(issueCreateVO);
		return BaseRespVo.ok(issueUpdate);
	}

	@RequestMapping("delete")
	public BaseRespVo issueDelete(@RequestBody IssueCreateVO issueCreateVO){
		 issueService.deleteIssue(issueCreateVO);
		return BaseRespVo.ok();
	}

}
